<template>
  <div>
    <Child class="child" keys="aaa" data-hash="afJasdHGUHa87d688723kjaghdhja" title="用户信息" :index="1" :uid="userInfo.id"
      :hh="userInfo.hh" :user-name="userInfo.name" @update-age="updateAge" ref="childref">
    </Child>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue'
import Child from "./Child.vue"


interface Member {
  id: number,
  name: string,
  hh?: number
  age?: number
}

export default defineComponent({
  components: {
    Child
  },

  setup() {
    const userInfo: Member = {
      id: 1,
      name: 'Petter',
      hh: 1,
      age: 20
    }

    const updateAge = (age: number): void => {
      userInfo.age = age;

      console.log("userInfo=updateAge=,", userInfo);

    }

    const childref = ref<any>(null)

    onMounted(() => {
      // child.value.getList();
      childref.value.getList()
    })

    return {
      childref,
      userInfo,
      updateAge
    }
  }
})
</script>

<style scoped>
a {
  color: yellow
}
</style>
